

<template>
  <div class="addUserInfo">
    <ViewTitle text="凭证信息" />
    <div class="box1">
      <div>
        <span style="width: 100px">就诊凭证类型:</span>
        <div>
          <el-radio-group v-model="params.cert_type">
            <el-radio label="01">电子凭证</el-radio>
            <el-radio label="02">身份证 </el-radio>
            <el-radio label="03"> 社保卡</el-radio>
          </el-radio-group>
        </div>
      </div>
      <div>
        <span style="width: 150px">就诊凭证编号:</span>
        <el-input
          size="mini"
          v-model="params.cert_no"
          placeholder="就诊凭证编号"
        ></el-input>
      </div>
      <div>
        <span>卡识别码:</span>
        <el-input
          size="mini"
          v-model="params.card_sn"
          placeholder="卡识别码"
        ></el-input>
      </div>
       <div>
      <span>异地:</span>
         <el-checkbox v-model="params.is_yd"></el-checkbox>
      </div>

              <div v-if="params.is_yd">
      <span>参保地:</span>
                     <el-input v-model="params.insuplc_admdvs"></el-input>
     </div>
      <div>
        <el-button class="butB_Add" @click="selectUserInfo()"
          >读取个人基本信息</el-button
        >
        <el-button class="butB_Add" @click="readCard()">读卡</el-button>
          <el-button

        class="butB_Add"
        @click="guahao()"
        >挂号</el-button
      >
      </div>
    </div>

    <ViewTitle text="基础信息" />
    <div class="box1">
      <div>
        <span>人员编号:</span>
        <el-input size="mini" disabled v-model="baseinfo.psn_no"> </el-input>
      </div>
      <div>
        <span>证件类型:</span>
        <el-input size="mini" disabled v-model="baseinfo.psn_cert_type">
        </el-input>
      </div>
      <div>
        <span>证件号码:</span>
        <el-input size="mini" disabled v-model="baseinfo.certno"> </el-input>
      </div>
      <div>
        <span>姓名:</span>
        <el-input size="mini" disabled v-model="baseinfo.psn_name"> </el-input>
      </div>
      <div>
        <span>性别:</span>
        <el-input size="mini" disabled v-model="baseinfo.gend"> </el-input>
      </div>
      <div>
        <span>民族 :</span>
        <el-input size="mini" disabled v-model="baseinfo.naty"> </el-input>
      </div>
      <div>
        <span>出生日期:</span>
        <el-input size="mini" disabled v-model="baseinfo.brdy"> </el-input>
      </div>
      <div>
        <span>年龄:</span>
        <el-input size="mini" disabled v-model="baseinfo.age"> </el-input>
      </div>
    </div>
    <ViewTitle text="参保信息" v-if="insuinfo.length > 0" />

    <div v-if="insuinfo.length > 0">
      <el-table :data="insuinfo" border style="width: 100%">
        <template v-for="(item, index) in $baseBai['yibaoInfo']['list']">
          <el-table-column
          :key="index"
            :width="item.width"
            v-if="item.prop == 'redio'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <div>
                <el-radio
                  v-model="params.insutype"
                  @change="redioChange(scope.row)"
                  :label="scope.row.insutype"
                >
                  &nbsp;
                </el-radio>
              </div>
            </template>
          </el-table-column>
          <el-table-column
           :key="index"
            :width="item.width"
            v-else-if="item.prop == 'insutype'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <div v-if="scope.row.insutype">
                {{
                  yibao_insutype.find((v) => v.value == scope.row.insutype)
                    ? yibao_insutype.find((v) => v.value == scope.row.insutype)
                        .name
                    : scope.row.insutype
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
           :key="index"
            :width="item.width"
            v-else-if="item.prop == 'psn_type'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <div v-if="scope.row.psn_type">
                {{
                  yibao_psn_type.find((v) => v.value == scope.row.psn_type)
                    ? yibao_psn_type.find((v) => v.value == scope.row.psn_type)
                        .name
                    : scope.row.psn_type
                }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
           :key="index"
            :width="item.width"
            v-else-if="item.prop == 'cvlserv_flag'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <div v-if="scope.row.cvlserv_flag">
                {{ scope.row.cvlserv_flag == 1 ? "是" : "否" }}
              </div>
            </template>
          </el-table-column>
          <el-table-column
           :key="index"
            :width="item.width"
            v-else-if="item.prop == 'psn_insu_stas'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <div v-if="scope.row.psn_insu_stas">
                {{
                  $baseBai["yibaoInfo"]["status"].find(
                    (v) => v.value == scope.row.psn_insu_stas
                  )
                    ? $baseBai["yibaoInfo"]["status"].find(
                        (v) => v.value == scope.row.psn_insu_stas
                      ).label
                    : scope.row.psn_insu_stas
                }}
              </div>
            </template>
          </el-table-column>

          <el-table-column
           :key="index"
            v-else
            :width="item.width"
            :prop="item.prop"
            :label="item.label"
          >
          </el-table-column>
        </template>
      </el-table>
    </div>
    <ViewTitle v-if="thatF.yibao.selectType == 1" text="挂号信息" />
    <div v-if="thatF.yibao.selectType == 1" class="box1">
      <div>
        <span>门诊号:</span>
        <el-input size="mini" disabled v-model="params.patient_no"> </el-input>
      </div>
      <div>
        <span>医保挂号医生:</span>
        <!-- <selectInput :thatF="this"></selectInput> -->
        <el-popover placement="top" v-model="visibleDoctor" trigger="focus">
          <el-input
            placeholder="选择医生"
            slot="reference"
            size="mini"
            v-model="params.doctorReal_name"
            @input="getdoctorList()"
          >
            <i slot="suffix" class="el-input__icon el-icon-search"></i>
          </el-input>
          <el-table
            height="300"
            @current-change="xuanzeDoctor"
            highlight-current-row
            :data="
              doctorData.filter(
                (data) =>
                  !params.doctorReal_name ||
                  data.doctor.real_name
                    .toLowerCase()
                    .includes(params.doctorReal_name.toLowerCase())
              )
            "

          >
            <el-table-column type="index" label="序号" width="50">
            </el-table-column>

            <el-table-column
              width="100"
              property="doctor.real_name"
              label="医生"
            ></el-table-column>
            <el-table-column
              width="100"
              property="doctor.dept_name"
              label="科室"
            ></el-table-column>

            <el-table-column
              width="100"
              property="doctor.positional_title"
              label="职称"
            ></el-table-column>
          </el-table>

          <el-pagination
            :current-page="doctorPage"
            :page-size="doctorLimit"
            @current-change="handlePagination2"
            :total="doctorCount"
            layout="prev, pager, next"
          >
          </el-pagination>
        </el-popover>
      </div>

      <!-- <div>
        <span>就诊凭证类型:</span>

             <div>
               <el-select @change="psn_cert_typeChange" v-model="params.psn_cert_type" placeholder="就诊凭证类型" >
                <el-option
                  v-for="(item,index) in   $baseBai['yibaoInfo']['psn_cert_type']"
                  :key="'index1'+index"
                  :label="item.label"
                  :value="item.value"

                >
                </el-option>
              </el-select>
        </div>
         </div> -->
      <!-- <div>
            <span>就诊凭证编号:</span>
            <el-input
              size="mini"

              :placeholder="params.placeholder_certno"
              v-model="params.certno"
          >
            </el-input>
          </div> -->
    </div>

    <ViewTitle
      text="费用明细"
      v-if="thatF.yibao.selectType == 1 || thatF.yibao.selectType == 4"
    />

    <div class="box1">
      <div>
        <span>门诊号:</span>
        <el-input
          size="mini"
          disabled
          v-model="thatF.yibao.selectItem.patient_no"
        >
        </el-input>
      </div>
      <div v-if="thatF.activeName == '2'">
        <span>医疗类别:</span>
        <div>
          <el-select
            size="mini"
            v-model="params.med_type"
            placeholder="医疗类别"
          >
            <el-option
              v-for="(item, index) in dict_med_type"
              :key="'index1' + index"
              :label="item.name"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
      </div>

      <div v-if="thatF.activeName == '2'">
        <span>诊断类别:</span>
        <div>
          <el-select
            size="mini"
            v-model="params.diag_type"
            placeholder="诊断类别"
          >
            <el-option
              v-for="(item, index) in dict_diag_type"
              :key="'index1' + index"
              :label="item.name"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </div>
      </div>
      <!-- v-if="thatF.activeName=='2'&&params.med_type==14" -->
      <div v-if="thatF.activeName == '2'">
        <span>慢特病类型:</span>
        <selectInput :thatF="this"></selectInput>
      </div>
         <!-- <div v-if="thatF.activeName == '2'">
        <span>病种:</span>
                       <el-popover placement="bottom-end"  v-loading="threeSelectLoading" width="500px" trigger="focus">
                <el-input
                  placeholder="选择病种"
                  slot="reference"
                  v-model="dise_name"
                  @input="daiyuinfo()"
                >
                  <i slot="suffix" class="el-input__icon el-icon-search"></i>
                </el-input>

                <el-table
                  v-loading="threeSelectLoading"
                  height="300"
                  @row-click="xuanzeDatathree"
                  :data="selectData1"
                  style="width: 100%"
                  ref="table"
                >
                  <el-table-column label="编号" prop="sp_code" width="150">
                  </el-table-column>


                  <el-table-column label="病种名称" prop="sp_name">
                  </el-table-column>

                </el-table>
                <el-pagination
                  :current-page="page3"
                  :page-size="limit3"
                  @current-change="handlePagination"
                  :total="pageCount3"
                  layout="prev, pager, next"
                >
                </el-pagination>
              </el-popover>

                  </div>
                  <div v-if="thatF.activeName == '2'">
        <span>病种类型:</span>
        <el-select
                      v-model="params.dise_type_code"
                      placeholder="病种类型"
                    >
                      <el-option
                        v-for="(item, index) in binzhonglei"
                        :key="index"
                        :label="item.name"
                        :value="item.value"
                         @change="xianxuan"
                        >{{ item.name }}</el-option
                      >
                    </el-select>
      </div> -->

    </div>
    <div v-if="thatF.activeName == '1'">
      <el-table :data="fee_items" border style="width: 100%">
        <template v-for="(item, index) in $baseBai['yibaoInfo']['feiyong']" >
          <!-- <el-table-column
          :key="index"
            :width="item.width"
            v-if="item.prop == 'num'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <div> {{}}1</div>
            </template>
          </el-table-column> -->
          <el-table-column
          :key="index"
            :width="item.width"
            v-if="item.prop == 'hosp_appr_flag'"
            :prop="item.prop"
            :label="item.label"
          >
            <template slot-scope="scope">
              <el-select
                v-model="scope.row.hosp_appr_flag"
                placeholder="审核标志"
              >
                <el-option label="无须审批" value="0"></el-option>
                <el-option label="审批通过" value="1"></el-option>
                <el-option label="审批不通过" value="2"></el-option>
              </el-select>
            </template>
          </el-table-column>

          <el-table-column
          :key="index"
            v-else
            :width="item.width"
            :prop="item.prop"
            :label="item.label"
          >
          </el-table-column>
        </template>
      </el-table>
    </div>
    <div v-if="thatF.activeName == '2' && thatF.yibao.selectType == 4">
      <div class="box3" v-if="thatF.yibao.chargeDataArry.length > 0">
        <el-table
          style="width: 100%"
          border
          height="250"
          disabled
          :data="thatF.yibao.chargeDataArry"
        >
          <template v-for="(item, index) in $baseBai['yibaoInfo']['feiyongMX']">
            <el-table-column
            :key="index"
              :width="item.width"
              v-if="item.prop == 'rx_circ_flag'"
              :prop="item.prop"
              :label="item.label"
            >
              <template slot-scope="scope">
                <el-select
                  v-model="scope.row.rx_circ_flag"
                  placeholder="外购标志"
                >
                  <el-option label="是" value="1"></el-option>
                  <el-option label="否" value="2"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column
            :key="index"
              :width="item.width"
              v-else-if="item.prop == 'hosp_appr_flag'"
              :prop="item.prop"
              :label="item.label"
            >
              <template slot-scope="scope">
                <el-select
                  v-model="scope.row.hosp_appr_flag"
                  placeholder="审核标志"
                >
                  <el-option label="无须审批" value="0"></el-option>
                  <el-option label="审批通过" value="1"></el-option>
                  <el-option label="审批不通过" value="2"></el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              v-else
              :width="item.width"
              :prop="item.prop"
              :label="item.label"
              :key="index"
            >
            </el-table-column>
          </template>
        </el-table>
      </div>
    </div>

    <el-dialog
      title="结算"
      :close-on-click-modal="false"
      :modal="false"
      :destroy-on-close="true"
      v-if="params.jiesuanShow"
      :modal-append-to-body="true"
      :visible.sync="params.jiesuanShow"
    >
      <jiesuan :thatF="this"></jiesuan>
    </el-dialog>

    <div class="buts">
      <el-button
      v-if="thatF.activeName!=1"
        class="butB_Add"
        @click="chexiao()"
        >撤销费用明细</el-button
      >
      <el-button
     
        class="butB_Add"
        @click="upFeiyong()"
        >上传明细</el-button
      >


<el-button

        class="butB_Add"
        @click="next()"
        >结算</el-button
      >


    </div>
  </div>
</template>
<script>
let t;
import selectInput from "@/components/select";
import jiesuan from "./jiesuan";
import ViewTitle from "@/forComponents/viewTitle/index.vue";
import { mapState, mapActions } from "vuex";
import {getDiseaseSpecieDict } from "@/api/zhuyanre";
import {

  getdictIndex,

} from "@/api/register";
export default {
  props: ["thatF"],
  data() {
    return {
      setSelectInput: {
        placeholder: "请选择慢特病类型",
        key: "mantebing",
        url: "getdict_dataGetChronicDiseaseDict",
        keyword: "",
        id: "",

        list: [
          { label: "慢特病编码", prop: "m_code" },
          { label: "名称", prop: "name" },
          { label: "内部编码", prop: "number" },
        ],
      },
      visibleDoctor: false,
      params: {
        cert_type: "02", //凭证类型
        cert_no: "", //凭证号码
        card_sn: "", //卡识别码  类型为社保卡时必填
        userinfo: "",
        jiesuanShow: false,
        type: false,
        // dise_codg:'',
        // dise_name:'',
        insutype: "",
        is_yd:false,
        insuplc_admdvs:'',
      doctorReal_name:'',
        placeholder_certno: "",
        patient_no: "",
        doctor_id: "",
        selectData: {},
      // dise_type_code:'',
        med_type: "11",
        diag_type: "1",
      },
      baseinfo: {},
      insuinfo: {},

      fee_items: [],
      doctorData: [],
      doctorPage: 1,
      doctorLimit: 1000,
      doctorCount: 0,
      threeSelectLoading:false,
      selectData1:'',
      dise_name:'',
      pageCount3:0,
      page3:1,
      limit3:15,
      binzhonglei:[],
      jiesuanlist:[]
    };
  },
  mounted() {
    t = this;
    t.params.patient_no = t.thatF.yibao.selectItem.patient_no;
    t.params.doctor_id = t.thatF.yibao.selectItem.doctor_id;
    console.log(t.thatF.yibao.selectItem)
    if(t.thatF.yibao.selectItem.doctor_info){
        this.params.doctorReal_name = t.thatF.yibao.selectItem.doctor_info.real_name;
      this.params.doctor_id = t.thatF.yibao.selectItem.doctor_info.id;
    }else if(t.thatF.yibao.selectItem.doctor){
         this.params.doctorReal_name = t.thatF.yibao.selectItem.doctor.real_name;
      this.params.doctor_id = t.thatF.yibao.selectItem.doctor.id;
    }

    t.params.cert_no = t.thatF.yibao.selectItem.member==undefined?t.thatF.yibao.selectItem.member_info.id_card:t.thatF.yibao.selectItem.member.id_card
    if (t.thatF.activeName == "1") {
      t.fee_items = t.thatF.yibao.selectItem.fee_items.map((v) => {
        return {
          ...v,
          hosp_appr_flag: "1",
          num:1
        };
      });
      console.log( t.fee_items)
    }
    this.getdoctorList();
    this.daiyuinfo()
    this.getdiet_list()
    this.selectUserInfo()
  },

  methods: {

     handlePagination2(e){
        this.doctorPage=e
        this.getdoctorList()
    },
        handlePagination(e){
        this.page3=e
        this.daiyuinfo()
    },
        daiyuinfo(){
    //  this.centerDialogVisible2=true
     var data_t={
        keyword:this.dise_name,
        page: this.page3,
        limit: this.limit3
     }
       getDiseaseSpecieDict(data_t).then(res=>{
            this.pageCount3=res.data.count
    this.selectData1=res.data.list
       })
   },
       xuanzeDatathree(item) {
        console.log(item)
      this.dise_name=item.sp_name
       this.params.dise_codg=item.sp_code
       this.params.dise_name=item.sp_name

       this.threeSelectLoading=false
    },
         getdiet_list() {
      getdictIndex({ group_id: "63,73" })
        .then(res => {
          let data = res.data;

          data.forEach((item, key) => {

           if (item.id==73) {
              this.binzhonglei=item.items
            }else if(item.id==63){
               this.jiesuanlist=item.items
            }



          });
        })
        .catch(e => {});

    },


    readCard() {
      let t = this;

      console.log("cert_type", this.params.cert_type);
      if (!t.params.cert_type) {
        return t.$message.error("请选择就诊凭证类型");
      }

      if (t.params.cert_type == 2) {
        t["_API"].getReadcardUserinfo({}).then((res) => {
          if (res.code == 200) {
            t.params.cert_no = res.data.id_card;

            t.selectUserInfo();
          }
        });
      } else {
        t["_API"].getReadcardUserinfo2({}).then((res) => {
          if (res.code == 200) {
            t.params.cert_no = res.data.id_card;

            t.selectUserInfo();
          }
        });
      }

      // return t.$message.error("维护中.....")
    },
    redioChange(item) {
      t.params.selectData = item;
      console.log("t.params.selectData", t.params.selectData);
    },
    getdoctorList() {
      this.doctorLoading = true;
      let d = {
        keyword: this.params.doctorReal_name,
        page: this.doctorPage,
        limit: this.doctorLimit,
        // doctor_dept:this.setSelectInput.id,
      };
      this["_API"].getRegisterDoctorIndex(d).then((res) => {
        this.doctorLoading = false;
        if (res.code == 200) {
          this.doctorData = res.data.list;

          this.doctorCount = res.data.count;
        }
      });
    },
    xuanzeDoctor(item) {
      console.log("item", item);
      if (!item) {
        return;
      }

      this.params.doctorReal_name = item.doctor.real_name;
      this.params.doctor_id = item.doctor.id;

      this.visibleDoctor = false;
    },
    guahao() {
      // if(!t.params.type){
      //     return t.$message.error("请些读取社保信息")
      // }
      // if(!t.params.insutype){
      //   return t.$message.error("请选择险种类型")
      // }
      //    if(!t.setSelectInput.id){
      //     return t.$message.error("请选择挂号医生")
      //   }
      let d = {
        patient_no: t.params.patient_no,
        doctor_id: t.params.doctor_id,
        member_info: {
          psn_no: t.baseinfo.psn_no,
          insutype: t.params.insutype,
          psn_cert_type: t.params.cert_type,
          certno: t.params.cert_no,
          insuplc_admdvs: t.params.selectData.insuplc_admdvs,
        },
        fee_items: t.fee_items.map((v) => {
          return {
            amount: v.price,
            num: 1,
            price: v.price,
            med_list_codg: v.yb_code,
            hosp_appr_flag: v.hosp_appr_flag,
            medins_list_codg: v.number,
            fill_number: v.fill_number,
          };
        }),
      };

      t["_API"].getregisterYbRegisterUnion(d).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: res.message,
            type: "success",
          });
          // this.thatF.params.page=1;
          // this.thatF.getList()
        }
      });
      // let d={
      //   patient_no:t.params.patient_no,
      //   doctor_id:t.setSelectInput.id,
      //   member_info:{
      //     psn_no:t.baseinfo.psn_no,
      //     insutype:t.params.insutype,
      //     psn_cert_type:t.params.cert_type,
      //     certno:t.params.cert_no,
      //     insuplc_admdvs:t.params.selectData.insuplc_admdvs,
      //   },
      // }
      // t['_API'].getregisterYbRegister(d).then(res=>{
      //    if(res.code==200){
      //                           this.$message({
      //                             message: res.message,
      //                             type: "success",
      //                           });
      //                           this.thatF.params.page=1;
      //                           this.thatF.getList()
      //    }
      // })
    },
    next() {
      console.log("123");
      if (!t.params.type) {
        return t.$message.error("请些读取社保信息");
      }
      if (!t.params.insutype) {
        return t.$message.error("请选择险种类型");
      }
      this.params.jiesuanShow = true;
    },
    psn_cert_typeChange(item) {
      if (item == "01") {
        t.params.placeholder_certno = "电子凭证令牌";
      } else if (item == "02") {
        t.params.placeholder_certno = "身份证号";
      } else if (item == "03") {
        t.params.placeholder_certno = "会保障卡卡号";
      }
      console.log("item2", item);
    },
    selectUserInfo() {
      let d = {
        cert_no: t.params.cert_no,
        cert_type: t.params.cert_type,
        card_sn: t.params.card_sn,
        member_id: t.thatF.yibao.selectItem.member_id,
        is_yd:t.params.is_yd?1:'',
        insuplc_admdvs:t.params.insuplc_admdvs
      };

      if (t.params.cert_type == "3" && !t.params.card_sn) {
        return t.$message.error("请输入卡识别码");
      }

      this["_API"].getmemberGetInfo(d).then((res) => {
        if (res.code == 200) {
          t.params.type = true;
          t.baseinfo = res.data.baseinfo;
          t.insuinfo = res.data.insuinfo;
          t.baseinfo.gend = this.$baseYiBao.gend.find(
            (l) => l.key == t.baseinfo.gend
          ).name;
          // console.log(" this.dict_psn_cert_type.find(v=>v.value==t.baseinfo.psn_cert_type)",
          t.baseinfo.psn_cert_type = this.dict_psn_cert_type.find(
            (v) => v.value == parseInt(t.baseinfo.psn_cert_type)
          ).name;
          t.baseinfo.naty = this.dict_naty.find(
            (v) => v.value == parseInt(t.baseinfo.naty)
          ).name;
        }
      });
    },
    save() {
      console.log(this.params);

      for (let key in this.params) {
        if (!this.params[key])
          return this.$message.error("请填写资料完整后再进行提交");
      }

      this["_API"].postMemberSave(this.params).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: res.message,
            type: "success",
          });
          this.$emit("openUserInfo", this.params, res.data);
        }
      });
    },
    chexiao() {
      let d = {
        patient_no: t.thatF.yibao.selectItem.patient_no,
        order_number: t.thatF.yibao.selectItem.number,
      };
      this["_API"].getregisterBackFeeUpload2(d).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: res.message,
            type: "success",
          });

          t.thatF.getList();
          // t.thatF.yibao.show = false;
        }
      });
    },
    upFeiyong() {
      //    v-if="thatF.activeName!=1"
      if(t.thatF.activeName!=1){
        if (!t.params.med_type) {
          return t.$message.error("请选择医疗类别");
        }
        if (!t.params.diag_type) {
          return t.$message.error("请选择诊断类别");
        }

        let d = {
        patient_no: t.thatF.yibao.selectItem.patient_no,
        number: t.thatF.yibao.selectItem.number,
        med_type: t.params.med_type,
        visit_time: t.thatF.yibao.selectItem.created_at,

        diag_type: t.params.diag_type,
        //  dise_codg:t.params.dise_codg,
        //   dise_type_code:t.params.dise_type_code,
        fee_items: t.thatF.yibao.chargeDataArry.map((v) => {
          return {
            amount: v.amount,
            num: v.num ? v.num : 1,
            price: v.price,
            med_list_codg: v.yb_code,
            medins_list_codg: v.number,
            time: t.thatF.yibao.selectItem.created_at,
            fill_number: v.fill_number,
            rx_circ_flag: v.rx_circ_flag,
            hosp_appr_flag: v.hosp_appr_flag,
          };
        }),
      };
      // if (t.params.med_type == 14) {
        d.chronic_code = t.setSelectInput.id;
        d.chronic_name = t.setSelectInput.keyword;
      // }
      if(t.thatF.yibao.selectItem.medical_record.diagnosis.length!=0){
         d.disease_code=t.thatF.yibao.selectItem.medical_record.diagnosis[0].code
        d.disease_name=t.thatF.yibao.selectItem.medical_record.diagnosis[0].name
      }

      t["_API"].getclinic_feeUuploadFeeInf(d).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: res.message,
            type: "success",
          });

          // this.thatF.getList();
        }
      });
      }else{
        let d = {
        patient_no: t.thatF.yibao.selectItem.patient_no,
   
        fee_items: t.fee_items.map((v) => {
          return {
            amount: v.price,
            num: v.num ? v.num : 1,
            price: v.price,
            med_list_codg: v.yb_code,
            medins_list_codg: v.number,
            fill_number: v.fill_number,
            rx_circ_flag: v.rx_circ_flag,
            hosp_appr_flag: v.hosp_appr_flag,
          };
        }),
      };
        t["_API"].getclinic_RegisterFeeInf(d).then((res) => {
        if (res.code == 200) {
          this.$message({
            message: res.message,
            type: "success",
          });

          // this.thatF.getList();
        }
      });
      }
      
   

   
    },
  },
  computed: {
    ...mapState({
      dict_psn_cert_type: (state) => state.dictBai.dict_psn_cert_type,
      dict_naty: (state) => state.dictBai.dict_naty,
      yibao_insutype: (state) => state.dictBai.yibao_insutype,
      yibao_psn_type: (state) => state.dictBai.yibao_psn_type,
      dict_med_type: (state) => state.dictBai.dict_med_type,
      dict_diag_type: (state) => state.dictBai.dict_diag_type,
    }),
  },
  components: {
    ViewTitle,
    jiesuan,
    selectInput,
    //  FormInfo
  },
};
</script>
<style lang='scss' scoped>
.addUserInfo {
  padding: 0 4%;
  .box1 {
    display: flex;
    flex-wrap: wrap;
    padding: 20px 0;
    > div {
      position: relative;
      width: 33%;
      display: flex;
      align-items: center;
      // justify-content: center;
      margin-bottom: 20px;

      > span {
        display: inline-block;
        width: 100px;
      }
      /deep/ .el-input {
        width: 200px;
      }
    }
  }
  .box3 {
    margin: 20px 0;
  }

  .dukaBut {
    margin: 0px 0 20px;
  }
}

.buts {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  button {
    width: 200px;

    bottom: 28px;
    right: 45px;
  }
}
</style>
